<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
        // fetch('http://ajax-api.itheima.net/api/category/top')
        //     .then(res => res.json())
        //     .then(res => {
        //         console.log(res)
        //         return res.data.map(el => {
        //             return fetch(`http://ajax-api.itheima.net/api/category/sub?id=${el.id}`)
        //                 .then(res => res.json())
        //         })
        //     })
        //     .then(res => {
        //         // console.log(res)
        //         Promise.all(res).then(res => console.log(res))
        //     })

        axios({
            method: 'get',
            url: 'http://ajax-api.itheima.net/api/category/top',
            responseType: 'json'
        })
            .then(res => {
                console.log(res.data)
            })

            async function goods() {
                
            }
    </script>
</body>

</html>